package com.woniuxy.educationplatform.util;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;

import java.io.InputStream;
import java.util.List;

/**
 * @author unreleased
 * @date 2020/12/15 21:33
 */
public class ExcelUtil {
    public static List<?> importExcel(InputStream inputStream, Class<?> clazz) throws Exception {
        ImportParams importParams = new ImportParams();
        // 设置表头行数,默认1
        importParams.setHeadRows(1);
        // 设置表格标题行数,默认0
        importParams.setTitleRows(0);
        return ExcelImportUtil.importExcelMore(inputStream, clazz, importParams).getList();
    }
}
